/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SensorCheckersImpl;

import CommonValue.WSMessage;
import SensorCheckerInterface.ISensorChecker;
import DTO.SensorDTO;
/**
 *
 * @author Administrator
 */
public class BaseSensorChecker implements ISensorChecker {

    private String sensorCheckerSign;

    public BaseSensorChecker() {
    }

    public BaseSensorChecker(String sensorCheckerSign) {
        this.sensorCheckerSign = sensorCheckerSign;
    }

    @Override
    public boolean isMatchSign(SensorDTO o) {
        return (o.getSensorSign().equalsIgnoreCase(sensorCheckerSign));
    }


    @Override
    public boolean checkInputNull(SensorDTO o){
        return (o == null);
    }

    

    @Override
    public String getSensorCheckerSign() {
        return sensorCheckerSign;
    }

    public void setSensorCheckerSign(String sensorCheckerSign) {
        this.sensorCheckerSign = sensorCheckerSign;
    }

    @Override
    public boolean checkNull(SensorDTO ob){
        if (ob == null){
            System.out.println(WSMessage.INPUT_IS_NULL);
            return true;
        }
        if (ob.getSensorSign()== null){
            System.out.print(WSMessage.SIGN_IS_NULL);
            return true;
        }
        if (ob.getData().get(ob.getSensorSign())==null){
            System.out.println(WSMessage.VALUE_IS_NULL);
            return true;
        }
        return false;

    }

    @Override
    public boolean CheckSensor(SensorDTO o) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}
